package com.xiaomaoaixue.wecom.client;

import com.dtflys.forest.annotation.*;
import com.xiaomaoaixue.wecom.domain.dto.WeResultDto;
import com.xiaomaoaixue.wecom.domain.dto.WeUserDto;
import com.xiaomaoaixue.wecom.domain.dto.WeUserInfoDto;
import com.xiaomaoaixue.wecom.domain.dto.WeUserListDto;
import com.xiaomaoaixue.wecom.interceptor.WeAccessTokenInterceptor;
import com.xiaomaoaixue.wecom.interceptor.WeAppAccessTokenInterceptor;
import com.xiaomaoaixue.wecom.interceptor.WeCommonAccessTokenInterceptor;
import com.xiaomaoaixue.wecom.retry.WeCommonRetryWhen;

/**
 * @description: 企业微信通讯录成员
 * @author: HaoN
 * @create: 2020-08-27 16:42
 **/
@BaseRequest(baseURL = "${weComServerUrl}${weComePrefix}", interceptor = WeCommonAccessTokenInterceptor.class)
@Retry(maxRetryCount = "3", maxRetryInterval = "1000", condition = WeCommonRetryWhen.class)
public interface WeUserClient {


    /**
     *  获取部门成员
     * @param departmentId
     * @param fetchChild
     * @return
     */
    @Request(url="/user/simplelist")
    WeUserListDto  simpleList(@Query("department_id") Long departmentId,@Query("fetch_child") Integer fetchChild);

    /**
     *  获取部门成员
     * @param departmentId
     * @param fetchChild
     * @return
     */
    @Request(url="/user/list")
    WeUserListDto list(@Query("department_id") Long departmentId, @Query("fetch_child") Integer fetchChild);

    /**
     * 获取访问用户身份(内部应用)
     * @param code
     * @param agentId 应用的id,请求头中
     * @return
     */
    @Request(url = "/user/getuserinfo",interceptor = WeAppAccessTokenInterceptor.class)
    WeUserInfoDto  getUserInfo(@Query("code")String code);



}
